<template>
    <group-paper-rule-component
        ref="groupPaperRuleComponent"
        :init-param="{ school: 'other' }"
    ></group-paper-rule-component>
</template>

<script>
import { mapState } from "vuex";
import groupPaperRuleComponent from "@/views/models/exam/component/groupPaperRuleComponent";

export default {
    name: "GroupPaperRule",
    components: { groupPaperRuleComponent },
    mixins: [],
    data() {
        return {
            initAddForm: {
                id: null,
                name: null,
                remark: null,
                actionCodes: []
            },
            actions: null,
            actionSearch: null,
            src:
                "https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg",
            contentDialogVisible: false,
            classificationInfo: [],
            content: [],
            initContent: {
                firstType: "",
                secondType: "",
                easyNum: "",
                normalNum: "",
                diffcultNum: "",
                everyScore: ""
            },
            options: [
                {
                    value: "singleChoice",
                    label: "单选题"
                },
                {
                    value: "multipleChoice",
                    label: "多选题"
                },
                {
                    value: "judgment",
                    label: "判断题"
                },
                {
                    value: "fill",
                    label: "填空题"
                },
                {
                    value: "text",
                    label: "简答题"
                },
                {
                    value: "combination",
                    label: "组合题"
                }
            ],
            secondTypeInfo: []
        };
    },
    computed: {
        ...mapState({
            status: state => state.status.paperType,
            questionFirstType: state => state.status.questionFirstType
        })
    },
    watch: {
        actionSearch(val) {
            this.$refs.tree.filter(val);
        },
        $route: function(to, from) {
            // 拿到目标参数 to.query.id 去再次请求数据接口
            if (from.name === "GroupAddRule") {
                this.$refs.groupPaperRuleComponent.search();
            }
        }
    },
    mounted() {},
    methods: {
        toEditPg(data) {
            data.addActioon = false;
            this.$router.push({
                name: "AddRule",
                params: {
                    dataForm: data,
                    addAction: false,
                    key: new Date().getTime()
                }
            });
        },
        toAddPg(data) {
            this.$router.push({
                name: "AddRule",
                params: {
                    dataForm: data,
                    addAction: true,
                    key: new Date().getTime()
                }
            });
        }
    }
};
</script>

<style lang="scss" scoped>
.container {
    background: #fff;
    border-radius: 0.3em 0.3em 0 0;
    padding-bottom: 1em;
    padding-top: 1em;
    padding-left: 1em;
    margin-top: 16px;

    .container-content {
        padding-top: 12px;

        p {
            color: #909399;
            font-size: 15px;
            padding-top: 12px;
        }
    }

    .container-right {
        margin-left: 12px;
        margin-top: 2em;

        .r-img {
            max-width: 240px;
            max-height: 160px;
        }

        .r-btn {
            margin-top: 22px;
        }
    }
}

.table-search-box {
    padding-left: 17px;
    font-size: 16px;
}
</style>
